<!--********************************************************************
* Copyright© 2000 - 2018 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title data-i18n="resources.title_panzoombar"></title>
    <script type="text/javascript" src="../js/include-web.js"></script>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
<script type="text/javascript">
    var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
    var map, layerWorld;
    var url = host + "/iserver/services/map-world/rest/maps/World";

    map = new SuperMap.Map("map", {
        controls: [
            new SuperMap.Control.Navigation({
                dragPanOptions: {
                    enableKinetic: true
                }
            })]
    });

    //初始化复杂缩放控件类
    panzoombar = new SuperMap.Control.PanZoomBar();
    // 是否固定缩放级别为[0,16]之间的整数，默认为false
    panzoombar.forceFixedZoomLevel = true;
    //是否显示滑动条，默认值为false
    panzoombar.showSlider = true;
    /*点击箭头移动地图时，所移动的距离占总距离（上下移动的总距离为高度，左右移动的总距离为宽度）
     的百分比，默认为null。 例如：如果slideRatio 设为0.5, 则垂直上移地图半个地图高度.*/
    panzoombar.slideRatio = 0.5;
    //设置缩放条滑块的高度，默认为120
    panzoombar.sliderBarHeight = 180;
    //设置缩放条滑块的宽度，默认为13
    panzoombar.sliderBarWidth = 17;
    map.addControl(panzoombar);
    layerWorld = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, {
        transparent: true,
        cacheEnabled: true
    }, {maxResolution: "auto"});    //获取图层服务地址
    layerWorld.events.on({"layerInitialized": addLayer});
    //添加地图图层、控件PanZoomBar到map
    function addLayer() {
        map.addLayer(layerWorld);
        map.setCenter(new SuperMap.LonLat(0, 0), 0);
    }
</script>
</body>
</html>
